import BaseRequest, {ApiResponse} from '@/shared/utils/request'
import { HOSTS } from '@/shared/constants/index'
import {UserListResp, UserModel, WxLoginResponse} from "@/shared/services/model/user";
import {CostOrderModel, OrderListResp, RechargeListResp} from "@/shared/services/model/order";

/**
 * 服务类示例
 */
class AdminService extends BaseRequest {
	constructor() {
		super({
			hostKey: HOSTS.TARO_API_BASE,
		})
	}

	/**
	 * 一个获取某项数据的 get 请求
	 */
  userList(payload: any): Promise<ApiResponse<UserListResp>> {
    return this.post<UserListResp>({
      url: '/api/v1/admin/userList',
      data: payload,
    })
  }

  singleUser(payload: any): Promise<ApiResponse<UserModel>> {
    return this.get<UserModel>({
      url: `/api/v1/admin/user/${payload.phone}`,
      data: payload,
    })
  }

  orderList(payload: any): Promise<ApiResponse<OrderListResp>> {
    return this.post<OrderListResp>({
      url: '/api/v1/admin/orderList',
      data: payload,
    })
  }

  rechargeList(payload: any): Promise<ApiResponse<RechargeListResp>> {
    return this.post<RechargeListResp>({
      url: '/api/v1/admin/rechargeList',
      data: payload,
    })
  }

  addRemark(payload: any): Promise<ApiResponse<any>> {
    return this.post<any>({
      url: '/api/v1/admin/addRemark',
      data: payload,
    })
  }
}

export default new AdminService()
